package com.yanqu.road.entity.activity.suitang.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.activity.suitang.entity.battle.CrossSuiTangBattlefield;
import com.yanqu.road.entity.activity.suitang.entity.team.CrossSuiTangTeam;
import com.yanqu.road.entity.activity.suitang.enums.eSuiTangWarType;

import java.util.Map;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_c_suitang_city_data")
public class CrossSuiTangCity extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "商会分组ID", select = true, update = true)
    private int groupId;

    @FieldTypeAnnotation(desc = "活动分组，每轮都会进行重新分组", update = true)
    private int actGroupId;

    @FieldTypeAnnotation(desc = "当前轮次", update = true)
    private int round;

    @FieldTypeAnnotation(desc = "当前所在战场", update = true)
    private eSuiTangWarType warType;

    @FieldTypeAnnotation(desc = "城市ID", update = true)
    private int cityId;

    @FieldTypeAnnotation(desc = "商会")
    private String unionId = "";

    @FieldTypeAnnotation(desc = "占领时间")
    private long occupyTime;

    @FieldTypeAnnotation(desc = "上次结算采集奖励时间")
    private long collectionTime;

    @FieldTypeAnnotation(desc = "城防军恢复开始时间，0表示不恢复")
    private long teamRecoveryBeginTime;

    @FieldTypeAnnotation(desc = "最后一次恢复额外守军的时间")
    private long lastRecoveryExtraTeamTime;

    @FieldTypeAnnotation(desc = "城市状态 0：空闲，1：战斗中")
    private int status;

    @FieldTypeAnnotation(desc = "城市状态变更时间")
    private long changeStatusTime;

    @FieldTypeAnnotation(desc = "阻击人数")
    private int needDefensePeople = 1;

    @FieldTypeAnnotation(desc = "上一次更新阻击人数时间,(空闲状态减人数，交战状态加人数)")
    private long updateDefensePeopleTime;

    @FieldTypeAnnotation(desc = "固有的NPC守卫")
    private Vector<Long> npcGuardList = new Vector<>() ;

    @FieldTypeAnnotation(desc = "基础 最大血量, 初始化后不会再变 , 根据 npcGuardList 的初始长度来设置的")
    private int maxHp = 0;

    @FieldTypeAnnotation(desc = "战场相关")
    private CrossSuiTangBattlefield battlefield = null;

    // 移动经过的队伍(后续修改成不入库)
    private Map<Long, CrossSuiTangTeam> moveTeamList = new ConcurrentHashMap<>();

    // ====================

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public int getGroupId() {
        return groupId;
    }
    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setOp(DataStatus.Update);
        }
    }

    public int getActGroupId() {
        return actGroupId;
    }
    public void setActGroupId(int actGroupId) {
        if (this.actGroupId != actGroupId) {
            this.actGroupId = actGroupId;
            setOp(DataStatus.Update);
        }
    }

    public int getRound() {
        return round;
    }
    public void setRound(int round) {
        if (this.round != round) {
            this.round = round;
            setOp(DataStatus.Update);
        }
    }

    public eSuiTangWarType getWarType() {
        return warType;
    }
    public void setWarType(eSuiTangWarType warType) {
        if (null == warType){
            return;
        }
        if (this.warType == null || !this.warType.equals(warType)) {
            this.warType = warType;
            setOp(DataStatus.Update);
        }
    }

    public int getCityId() {
        return cityId;
    }
    public void setCityId(int cityId) {
        if (this.cityId != cityId) {
            this.cityId = cityId;
            setOp(DataStatus.Update);
        }
    }

    public String getUnionId() {
        return unionId;
    }
    public void setUnionId(String unionId) {
        if (unionId == null){
            return;
        }
        if (this.unionId == null || !this.unionId.equals(unionId)) {
            this.unionId = unionId;
            setOp(DataStatus.Update);
        }
    }

    public long getOccupyTime() {
        return occupyTime;
    }
    public void setOccupyTime(long occupyTime) {
        if (this.occupyTime != occupyTime) {
            this.occupyTime = occupyTime;
            setOp(DataStatus.Update);
        }
    }

    public long getCollectionTime() {
        return collectionTime;
    }
    public void setCollectionTime(long collectionTime) {
        if (this.collectionTime != collectionTime) {
            this.collectionTime = collectionTime;
            setOp(DataStatus.Update);
        }
    }

    public long getTeamRecoveryBeginTime() {
        return teamRecoveryBeginTime;
    }
    public void setTeamRecoveryBeginTime(long teamRecoveryBeginTime) {
        if (this.teamRecoveryBeginTime != teamRecoveryBeginTime) {
            this.teamRecoveryBeginTime = teamRecoveryBeginTime;
            setOp(DataStatus.Update);
        }
    }

    public long getLastRecoveryExtraTeamTime() {
        return lastRecoveryExtraTeamTime;
    }
    public void setLastRecoveryExtraTeamTime(long lastRecoveryExtraTeamTime) {
        if (this.lastRecoveryExtraTeamTime != lastRecoveryExtraTeamTime) {
            this.lastRecoveryExtraTeamTime = lastRecoveryExtraTeamTime;
            setOp(DataStatus.Update);
        }
    }

    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        if (this.status != status) {
            this.status = status;
            setOp(DataStatus.Update);
        }
    }

    public Vector<Long> getNpcGuardList() {
        return npcGuardList;
    }
    public void setNpcGuardList(Vector<Long> npcGuardList) {
        if (null == npcGuardList){
            return;
        }
        if (this.npcGuardList == null || !this.npcGuardList.equals(npcGuardList)) {
            this.npcGuardList = npcGuardList;
            setOp(DataStatus.Update);
        }
    }

    public int getMaxHp() {
        return maxHp;
    }
    public void setMaxHp(int maxHp) {
        if (this.maxHp != maxHp) {
            this.maxHp = maxHp;
            setOp(DataStatus.Update);
        }
    }

    public long getChangeStatusTime() {
        return changeStatusTime;
    }

    public void setChangeStatusTime(long changeStatusTime) {
        if (this.changeStatusTime != changeStatusTime) {
            this.changeStatusTime = changeStatusTime;
            setOp(DataStatus.Update);
        }
    }

    public int getNeedDefensePeople() {
        return needDefensePeople;
    }

    public void setNeedDefensePeople(int needDefensePeople) {
        if (this.needDefensePeople != needDefensePeople) {
            this.needDefensePeople = needDefensePeople;
            setOp(DataStatus.Update);
        }
    }

    public long getUpdateDefensePeopleTime() {
        return updateDefensePeopleTime;
    }

    public void setUpdateDefensePeopleTime(long updateDefensePeopleTime) {
        if (this.updateDefensePeopleTime != updateDefensePeopleTime) {
            this.updateDefensePeopleTime = updateDefensePeopleTime;
            setOp(DataStatus.Update);
        }
    }

    public CrossSuiTangBattlefield getBattlefield() {
        return battlefield;
    }
    public void setBattlefield(CrossSuiTangBattlefield battlefield) {
        if (null == battlefield){
            return;
        }
        if (this.battlefield == null || !this.battlefield.equals(battlefield)) {
            this.battlefield = battlefield;
        }
    }

    public Map<Long, CrossSuiTangTeam> getMoveTeamList() {
        return moveTeamList;
    }

    public void setMoveTeamList(Map<Long, CrossSuiTangTeam> moveTeamList) {
        this.moveTeamList = moveTeamList;
    }
}
